﻿using System;

namespace Qplus.Infrastructure
{
    /// <summary>
    /// Provides data for the DownloadStringCompleted event.
    /// </summary>
    public class DownloadStringCompletedEventArgs : EventArgs
    {
        #region Properties

        /// <summary>
        /// Gets the data that is downloaded by a DownloadStringAsync method.
        /// </summary>
        public string Result { get; private set; }

        /// <summary>
        /// Gets a value that indicates which error occurred during an asynchronous operation.
        /// </summary>
        public Exception Error { get; private set; }

        #endregion

        #region Constructors

        /// <summary>
        /// Creates a new instance of DownloadStringCompletedEventArgs with the specified result data.
        /// </summary>
        /// <param name="result">The data that is downloaded by a DownloadStringAsync method.</param>
        public DownloadStringCompletedEventArgs(string result)
        {
            Result = result;
        }

        /// <summary>
        /// Creates a new instance of DownloadStringCompletedEventArgs with the specified exception.
        /// </summary>
        /// <param name="ex">The exception generated by the asynchronous operation.</param>
        public DownloadStringCompletedEventArgs(Exception ex)
        {
            Error = ex;
        }

        #endregion
    }
}
